﻿@{
ViewBag.Title = "Home";
Layout = null;
}

@model MvcApplication5.Models.DetailsModel

@{
    //var RelatedNews = (from item in Model. where (item. == 1) select item);                                    
}

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
    <link rel="stylesheet" type="text/css" href="/css/style.css" media ="all" />
    <link href="/CSS/styleSlide.css" rel="stylesheet" />
    <link href="/CSS/ddlevelsmenu-base.css" rel="stylesheet" />
    <link href="/CSS/ddlevelsmenu-topbar.css" rel="stylesheet" />
    <link href="/CSS/ddlevelsmenu-sidebar.css" rel="stylesheet" />
    <script src="/CSS/ddlevelsmenu.js"></script>
    <script src="/CSS/jquerySlide.js"></script>
<script lang="JavaScript">
    function validate() {
        var x = document.getElementById("Comment_Name").value;
        var y = document.getElementById("Comment_Content").value;        
        if (x == null || x == "") {
            alert("Tên hiển thị không được để trống!");
            return false;
        }
        if (y == null || y == "" || y == "Ý kiến của bạn") {
            alert("Nội dung bình luận không được để trống!");
            return false;
        }
        return true;
    }
</script>
</head>
<body>
<div class="main">
	<div class="header">
        <div id="wowslider-container1">
	        <div class="ws_images">
                <ul>     
                    <li><img src="../../CSS/Images/banner.jpg" id="wows1_0" /></li>
                    <li><img src="../../CSS/Images/banner2.jpg" id="wows1_1"/></li>
                    <li><img src="../../CSS/Images/banner3.jpg" id="wows1_2" /></li>
                    <li><img src="../../CSS/Images/banner3.jpg" id="wows1_3" /></li>
                </ul>
            </div>
	    </div>
    </div> <!--End header-->
    <div class="header-footer"></div>
    <div class="menu">
    	<ul>
        	<li class="menu-sub"><a href="/NewsSite" class="menu-sub-text">Trang chủ</a></li>
            @foreach (var item in Model.Categories.Where(c => c.Tag.Length == 4))
            {
                    <li class="menu-sub"><a href="/NewsSite/Category/@item.CategoryId" class="menu-sub-text">@item.Name</a></li>                                
            }            
        </ul>
    </div> <!--End menu-->
    
    <div class="body">
    	<div class="body-left">
            <div class="news-body">
                <div class="news-header">
                    <h1>@Model.News.Title</h1>
                    @{var Author = Model.News.Author != null ? Model.News.Author.Name : "";}
                    <p>@Author | @Model.News.PublishedDate</p>
           		</div>
                <div class="news-content">                      
                    @Html.Raw(Model.News.Content)
                </div> <!--End news-content-->
            </div> <!--End news-body-->
            @if (Model.relatedNews.Count() > 0){
                <div class="related-box">                
                    <h3 class="related-header">Tin Liên quan</h3>  
                                                              
                    @foreach(var item in Model.relatedNews.Take(3)){
                        <div class="related-news">
                            <a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none"><img src="/css/images/@item.Image" class="related-news-image"/></a>
                            <a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none"><h4 class="related-news-title">@item.Title</h4></a>
                        </div>
                    }                                                            
            </div> <!--End related-box-->
            }
            <div class="tag-box">
                <div class="tag-body">
                    TAG:
                    @foreach(var item in Model.tagList){
                        if (item == Model.tagList.Last()){
                            <a href="/NewsSite/Tag/@item.TagId" style="text-decoration:none"><h3 class="tag-text">@item.TagName</h3></a>
                        }else{
                            <a href="/NewsSite/Tag/@item.TagId" style="text-decoration:none"><h3 class="tag-text">@item.TagName,</h3></a>
                        }                    
                    }
                </div>
            </div> <!--End tag box-->
            <form action="/NewsSite/Details/@Model.News.NewsId" name="myForm" method="post" onsubmit="return validate()">
                <div class="comment-box">
                    <div class="comment-header">
                        Viết bình luận
                    </div>
                    <div class="comment-body">
                        <h4 class="comment-header2">Tên hiển thị</h4>
                        @Html.EditorFor(model => model.Comment.Name)
                        <h4 class="comment-header2">Nội dung</h4>
                        <textarea style="width:672px; height:60px;" id="Comment_Content" name="Comment.Content" onblur="if(this.value=='') this.value=this.defaultValue" onfocus="if(this.value==this.defaultValue) this.value=''">Ý kiến của bạn</textarea>                   
                        <div class="comment-button">
                            <input type="submit" value="Gửi bình luận"/>
                            @Html.HiddenFor(model => model.News.NewsId)
                        </div>
                    </div>
                    @if (Model.commentList.Count() > 0)
                    {
                        <div class="comment-bar">@Model.commentList.Count() bình luận</div>
                    }else{
                        <div class="comment-bar">Chưa có bình luận nào</div>
                    }
                    @foreach (var item in Model.commentList)
                    {
                        <div class="comment-list">
                            <p class="comment-text-name">@item.Name <span class="comment-text-date">@item.Date</span></p>
                            <p>@item.Content</p>
                        </div>
                    }
                                                                
                </div><!--End comment-->                
            </form>                                                  	                                                              
        </div> <!--End body-left-->
        <div class="body-right">
            <div class="body-right-header">
                @using(Html.BeginForm("Search","NewsSite")){
                    <input type="text" class="body-right-searchbar" name="searchString"/>
                    <input type="submit" class="body-right-searchbutton" value="Tìm kiếm"/>
                }
            </div>            
            <div class="body-right-content2">
                <div class="body-right-header">
                    <h3 class="body-right-title">Xem nhiều nhất</h3>
                </div>
                <div class="body-right-content2-scroll">                                                
                <table class="body-left-topic-content03-right-table">                            
                            @foreach (var item in Model.MostViewed) {                                                                
                                    <tr>
                                        <td><a href="/NewsSite/Details/@item.NewsId"><img src="/css/images/@item.Image" width="90"; height="55";></a></td>
                                        <td><a href="/NewsSite/Details/@item.NewsId" style="text-decoration:none">@item.Title</a></td>
                                    </tr>                                
                            }                           
                </table>
                </div>
            </div>            
        </div> <!--End body-right-->        
    </div> <!--End body-->    
</div> <!--End main-->
</body>
</html>

